/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mapbar.pay.action;
import com.mapbar.pay.entity.Device;
import com.mapbar.pay.service.DeviceService;
import org.apache.log4j.Logger;
/**
 * 获取激活码页面
 *创建时间 2010-3-8 14:31:31
 * @author fengbj
 */
public class GetActivationCodeAction extends BaseAction{

    private Logger logger = Logger.getLogger(this.getClass()); //日志对象
    private Device device;
    private DeviceService deviceService;
    
    @Override
    public String execute(){
        if(getUser() != null){
            logger.info("用户:" + getUser().toString() + "获取设备信息");
            device = deviceService.getDeviceInfo(getUser().getSerial());
            if(device != null){
                if(device.isIsActive()){
                    device = null;
                    logger.info("用户激活码已经激活，不再显示详细信息");
                }else{
                    logger.info("用户激活码没有激活，显示详细信息");
                }
            }else{
                logger.error("用户："+getUser().toString() + "获取设备信息失败！");
            }
            
        }

        return SUCCESS;
    }

    public Device getDevice() {
        return device;
    }

    public void setDevice(Device device) {
        this.device = device;
    }

    public void setDeviceService(DeviceService deviceService) {
        this.deviceService = deviceService;
    }




}
